package Cm818_Zj_Mi;

import java.util.*;

/** 
 bsodManager ��ժҪ˵����
*/
public class bsodManager
{
	public bsodManager()
	{
	}
	public final boolean BsodNowManager(int ID, String RightNumber, String Number, int bsodMoney, String Manager, int zhushu, tangible.RefObject<String> CPNum, tangible.RefObject<Integer> ZjhCount)
	{
		String RightNumberBSOD = RightNumber.substring(3); //��С��˫����ȷ��������
		String number = Number;
		String[] a = tangible.DotNetToJavaStringHelper.trimEnd(number, ',').split("[,]", -1);
		int length = a.length;
		int templength = 0;
		boolean islast = false;
		ArrayList al1 = new ArrayList();
		ArrayList al2 = new ArrayList();

		for (int i = 0; i < a.length; i++)
		{
			al1.add(a[i].toString().substring(0,1));
			al2.add(a[i].toString().substring(1, 2));
		}

		for (String d : al1)
		{
			for (String e : al2)
			{
				int zjs = 0;
				//string f = d+e;
				if (rich(Integer.parseInt(d), Integer.parseInt(e), RightNumberBSOD))
				{
					templength++;
					ZjhCount.argValue++;
					zjs++;
					WinManager o = new WinManager();
					if (!o.ToManager(ID, bsodMoney, RightNumberBSOD, Manager, zhushu, CPNum))
					{
						return false;
					}
				}
				else
				{
					templength++;
					boolean hadEacn = false;
					NoWinManager nwm = new NoWinManager();
					if (zjs != 0)
					{
						hadEacn = true;
					}
					if (templength == length)
					{
						islast = true;
					}

					if (!nwm.ToManager(ID, islast, hadEacn, Manager))
					{
						return false;
					}
				}
			}
		}
		return true;
	}



	private boolean rich(int s, int g, String right)
	{
		int rs = Integer.parseInt(right.substring(0,1));
		int rg = Integer.parseInt(right.substring(1, 2));
		if (dd(rs, rg)) //���
		{
			if (dd2(s, g))
			{
				return true;
			}
		}

		if (dx(rs, rg)) //��С
		{
			if (dx2(s, g))
			{
				return true;
			}
		}
		if (ddan(rs, rg)) //��
		{
			if (ddan2(s, g))
			{
				return true;
			}
		}
		if (dshuang(rs, rg)) //��˫
		{
			if (dshuang2(s, g))
			{
				return true;
			}
		}
		if (xd(rs, rg)) //С��
		{
			if (xd2(s, g))
			{
				return true;
			}
		}
		if (xx(rs, rg)) //СС
		{
			if (xx2(s, g))
			{
				return true;
			}
		}
		if (xdan(rs, rg)) //С��
		{
			if (xdan2(s, g))
			{
				return true;
			}
		}
		if (xshuang(rs, rg)) //Сˬ
		{
			if (xshuang2(s, g))
			{
				return true;
			}
		}
		if (danda(rs, rg))
		{
			if (danda2(s, g))
			{
				return true;
			}
		}
		if (danxiao(rs, rg))
		{
			if (danxiao2(s, g))
			{
				return true;
			}

		}
		if (dandan(rs, rg))
		{
			if (dandan2(s, g))
			{
				return true;
			}

		}

		if (danshuang(rs, rg))
		{
			if (danshuang2(s, g))
			{
				return true;
			}

		}
		if (shuangda(rs, rg))
		{
			if (shuangda2(s, g))
			{
				return true;
			}

		}
		if (shuangxiao(rs, rg))
		{
			if (shuangxiao2(s, g))
			{
				return true;
			}

		}

		if (shuangdan(rs, rg))
		{
			if (shuangdan2(s, g))
			{
				return true;
			}

		}
		if (shuangshuang(rs, rg))
		{
			if (shuangshuang2(s, g))
			{
				return true;
			}

		}



		return false;

	}

	private boolean shuangshuang(int a, int b)
	{
		if (a % 2 == 0)
		{
			if (b % 2 == 0)
			{
				return true;
			}
		}
		return false;
	}

	private boolean shuangshuang2(int a, int b)
	{
		if (a == 4 && b == 4)
		{
			return true;
		}
		return false;
	}
	private boolean shuangdan(int a, int b)
	{
		if (a % 2 == 0)
		{
			if (b % 2 != 0)
			{
				return true;
			}
		}
		return false;
	}
	private boolean shuangdan2(int a, int b)
	{
		if (a == 4 && b == 3)
		{
			return true;
		}
		return false;
	}

	private boolean shuangxiao(int a, int b)
	{
		if (a % 2 == 0)
		{
			if (b < 5)
			{
				return true;
			}
		}
		return false;
	}

	private boolean shuangxiao2(int a, int b)
	{
		if (a == 4 && b == 2)
		{
			return true;
		}
		return false;
	}

	private boolean shuangda(int a, int b)
	{
		if (a % 2 == 0)
		{
			if (b >= 5)
			{
				return true;
			}
		}
		return false;
	}

	private boolean shuangda2(int a, int b)
	{
		if (a == 4 && b == 1)
		{
			return true;
		}
		return false;
	}



	private boolean danshuang(int a, int b)
	{
		if (a % 2 != 0)
		{
			if (b % 2 == 0)
			{
				return true;
			}
		}
		return false;
	}
	private boolean danshuang2(int a, int b)
	{
		if (a == 3 && b == 4)
		{
			return true;
		}
		return false;
	}

	private boolean dandan(int a, int b)
	{
		if (a % 2 != 0)
		{
			if (b % 2 != 0)
			{
				return true;
			}
		}
		return false;
	}
	private boolean dandan2(int a, int b)
	{
		if (a == 3 && b == 3)
		{
			return true;
		}
		return false;
	}


	private boolean danxiao(int a, int b)
	{
		if (a % 2 != 0)
		{
			if (b < 5)
			{
				return true;
			}
		}
		return false;
	}

	private boolean danxiao2(int a, int b)
	{
		if (a == 3 && b == 2)

		{
			return true;
		}
		return false;
	}

	private boolean danda(int a, int b)
	{
		if (a % 2 != 0)
		{
			if (b >= 5)
			{
				return true;
			}
		}
		return false;
	}
	private boolean danda2(int a, int b)
	{
		if (a == 3 && b == 1)
		{
			return true;
		}
		return false;
	}

	private boolean xshuang(int a, int b)
	{
		if (a < 5)
		{
			if (b % 2 == 0)
			{
				return true;
			}
		}
		return false;
	}

	private boolean xdan(int a, int b)
	{
		if (a < 5)
		{
			if (b % 2 != 0)
			{
				return true;
			}
		}
		return false;
	}

	private boolean xx(int a, int b)
	{
		if (a < 5 && b < 5)
		{
			return true;
		}
		return false;
	}

	private boolean xd(int a, int b)
	{
		if (a < 5 && b >= 5)
		{
			return true;
		}
		return false;
	}


	private boolean dd(int a, int b)
	{
		if (a >= 5 && b >= 5)
		{
			return true;
		}
		return false;
	}

	private boolean dx(int a, int b)
	{
		if (a >= 5 && b < 5)
		{
			return true;
		}
		return false;
	}
	private boolean ddan(int a, int b)
	{
		if (a >= 5)
		{
			if (b % 2 != 0)
			{
				return true;
			}
		}
		return false;
	}

	private boolean dshuang(int a, int b)
	{
		if (a >= 5)
		{
			if (b % 2 == 0)
			{
				return true;
			}
		}
		return false;
	}






	private boolean xshuang2(int a, int b)
	{
		if (a == 2 && b == 4)
		{
			return true;
		}
		return false;
	}

	private boolean xdan2(int a, int b)
	{
		if (a == 2 && b == 3)
		{
			return true;
		}
		return false;
	}

	private boolean xx2(int a, int b)
	{
		if (a == 2 && b == 2)
		{
			return true;
		}
		return false;
	}

	private boolean xd2(int a, int b)
	{
		if (a == 2 && b == 1)
		{
			return true;
		}
		return false;
	}


	private boolean dd2(int a, int b)
	{
		if (a == 1 && b == 1)
		{
			return true;
		}
		return false;
	}

	private boolean dx2(int a, int b)
	{
		if (a == 1 && b == 2)
		{
			return true;
		}
		return false;
	}
	private boolean ddan2(int a, int b)
	{
		if (a == 1 && b == 3)
		{
			return true;
		}
		return false;
	}

	private boolean dshuang2(int a, int b)
	{
		if (a == 1 && b == 4)
		{
			return true;
		}
		return false;
	}
}